<?php
/** ============================================================
 * Class for creation of meta info
 * ============================================================ */

class Meta
{
	/** var title
    * @var string
    */
	public static $title;
	
	/** var description
    * @var string
    */
	public static $description;	
	
	/** var rating
    * @var string
    */
	public static $rating;
	
	
	/** _set
    * This function set default value for metadata.
	*
    * @version 2013-03-04
	* @return void
    */
    public static function _set(){
		if(empty(self::$title))
			self::$title = _fmt('meta.title.default');
    }
	
	/** setTitle
	* Set a value to the meta title.
	*
    * @version 2013-03-04
    * @param string $data
    * @return void
    */
	public static function setTitle($data){
		return self::$title = $data;
	}	
	
	/** getTitle
	* This function gets the Title of the page.
	*
    * @version 2013-03-04
    * @param string $data
    * @return string
    */
	public static function getTitle(){
		self::_set();
		return self::$title;
	}
	
	/** setDesc
	* Set a value to the meta title.
	*
    * @version 2013-03-04
    * @param string $data
    * @return void
    */
	public static function setDesc($data){
		return self::$description = $data;
	}
	
	/** getDesc
	* This function gets the Description of the page.
	*
    * @version 2013-03-04
    * @param string $data
    * @return string
    */
	public static function getDesc(){
		if(empty(self::$description))
			return null;
		else
			return '<meta name="description" content="'.htmlspecialchars(self::$description).'" >'."\n";
	}	
	
	/** setDesc
	* Set a value to the meta rating.
	*
    * @version 2013-03-04
    * @param string $data
    * @return void
    */
	public static function setRating($name,$ratingValue,$reviewCount){
		return self::$rating = '<div itemscope itemtype="http://schema.org/localbusiness" class="hide">
				<span itemprop="name">'.$name.'</span><div itemprop="aggregateRating" itemscope itemtype="http://schema.org/AggregateRating">
				<span itemprop="ratingValue">'.$ratingValue.'</span> of 5 rating from <span itemprop="reviewCount">'.$reviewCount.'</span> customer reviews.</div></div>';
	}
	
	/** getDesc
	* This function gets the Rating of the page.
	*
    * @version 2013-03-04
    * @param string $data
    * @return string
    */
	public static function getRating(){
		if(empty(self::$rating))
			return null;
		else
			return self::$rating;
	}
}